package com.atguigu.day12.abstract02.a3;

/**
 * @version 1.0
 * @Author 马冰
 * @Date 2024/11/13 10:29
 * @注释
 */
public class Rectangle extends Graphic{
    private double length;
    private double width;

    @Override
    public double area() {
        return length * width;
    }

    @Override
    public double perimeter() {
        return 2 * (length + width);
    }

    @Override
    public String toString() {
        return "长:" + length + "宽:" + width + super.toString();
    }

    public Rectangle() {
    }

    public Rectangle(double length, double width) {
        this.length = length;
        this.width = width;
    }

    public double getLength() {
        return length;
    }

    public void setLength(double length) {
        this.length = length;
    }

    public double getWidth() {
        return width;
    }

    public void setWidth(double width) {
        this.width = width;
    }
}
